Skip to content

feat: explicitly throw if TeamTemplate.getRawOrNil gets nil input#7705

Open
ElectricalBoy wants to merge 4 commits into
mainfrom
team-template-better-nil
Open

feat: explicitly throw if TeamTemplate.getRawOrNil gets nil input#7705
ElectricalBoy wants to merge 4 commits into
mainfrom
team-template-better-nil

Conversation

@ElectricalBoy

Copy link
Copy Markdown
Collaborator

Summary

Inspiration: #6863 (comment)

This PR adjusts TeamTemplate.getRawOrNil to explicitly throw if team argument is nil.
There is no change in behavior (team:gsub throws if team is nil in the current implementation anyway); this is for making the check explicit and generating a more comprehensive error message.

How did you test this change?

trivial

Comment thread lua/wikis/commons/TeamTemplate.lua Outdated
@ElectricalBoy ElectricalBoy force-pushed the team-template-better-nil branch from a91eb2d to ce29ca9 Compare July 7, 2026 05:04
Comment on lines -91 to 94
if Logic.isEmpty(team) then
return
end
assert(team ~= nil, 'TeamTemplate.getRawOrNil: \'team\' must not be nil')
team = team:gsub('_', ' '):lower()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

team:gsub throws if team is nil in the current implementation anyway

But that's not fully true? Since there's an early return if it's nil through the Logic Check?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's adjusted behavior from #6624
pr description was true until #6624 was merged

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it still work doing then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants